package com.zs.service.impl;

import com.google.gson.Gson;
import com.zs.common.config.ResponseCode;
import com.zs.mapper.EngineerMapper;
import com.zs.model.EngineerEntity;
import com.zs.model.ResponseCodeEntity;
import com.zs.model.criteria.BaseCriteria;
import com.zs.service.EngineerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zxw on 2017/7/8.
 */
@Service("engineerService")
public class EngineerServiceImpl implements EngineerService {

    @Resource
    private EngineerMapper engineerMapper;

    @Resource
    private Gson gson;

    @Override
    public String selectEngineerList(BaseCriteria baseCriteria) {
        List<EngineerEntity> engineerListList = engineerMapper.selectEngineerList(baseCriteria);
        ResponseCodeEntity selectResult = new ResponseCodeEntity(ResponseCode.DATA_OK, ResponseCode.DATA_SUCESS,
                engineerListList, engineerListList.size(),baseCriteria.getPageNo(), baseCriteria.getPageSize());
        return gson.toJson(selectResult);
    }
}
